package com.ourteam.scm.utils;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.ArrayUtils;

public class ShowResourceLogConfig {

	private String fileExtension;
	
	private boolean countLine;
	
	private boolean showDiff;

	public String getFileExtension() {
		return fileExtension;
	}

	public void setFileExtension(String fileExtension) {
		this.fileExtension = fileExtension;
	}

	public boolean isCountLine() {
		return countLine;
	}

	public void setCountLine(boolean countLine) {
		this.countLine = countLine;
	}

	public boolean isShowDiff() {
		return showDiff;
	}

	public void setShowDiff(boolean showDiff) {
		this.showDiff = showDiff;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fileExtension == null) ? 0 : fileExtension.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ShowResourceLogConfig other = (ShowResourceLogConfig) obj;
		if (fileExtension == null) {
			if (other.fileExtension != null)
				return false;
		} else if (!fileExtension.equalsIgnoreCase(other.fileExtension))
			return false;
		return true;
	}
	
	public static void main(String[] args) {
		ShowResourceLogConfig config1 = new ShowResourceLogConfig();
		
		config1.setFileExtension("java");
		
		ShowResourceLogConfig config2 = new ShowResourceLogConfig();
		
		config2.setFileExtension("java");
		
		System.out.println(FilenameUtils.getExtension("/net.common/api/public/net/ui/model/form/FormPropertyBean.java"));
		
		System.out.println(config1.equals(config2));
		
		System.out.println(ArrayUtils.indexOf(new ShowResourceLogConfig[]{config1},config2));
	}
	
	
}
